package com.tech.koufu.ui.activity.setting;

import com.tech.koufu.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

public class FAQActivity extends Activity{
	private WebView wb_faq;
	private TextView tv_title;
	private ImageView img_callback;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_faq);
		initView();
	}
	
	private void initView(){
		wb_faq = (WebView)findViewById(R.id.wb_faq);
		tv_title = (TextView)findViewById(R.id.tv_title);
		tv_title.setText("常见问题");
		tv_title.setVisibility(View.VISIBLE);
		img_callback = (ImageView)findViewById(R.id.img_callback);
		img_callback.setVisibility(View.VISIBLE);
		img_callback.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				FAQActivity.this.finish();
			}
		});
		loadFAQ();
	}
	
	private void loadFAQ(){
		String url = "http://www.cofool.com/stock/stockfaq.asp";
		WebSettings webSettings = wb_faq.getSettings();
//		webSettings.setDomStorageEnabled(true);
//		webSettings.setDatabaseEnabled(true);    
//		String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); 
		wb_faq.getSettings().setJavaScriptEnabled(true);
		wb_faq.getSettings().setBuiltInZoomControls(true);
		wb_faq.setWebViewClient(new WebViewClient(){
			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				// TODO Auto-generated method stub
				super.onPageStarted(view, url, favicon);

			}

			@Override
			public void onPageFinished(WebView view, String url) {
				// TODO Auto-generated method stub
				super.onPageFinished(view, url);
			}
		});
		wb_faq.loadUrl(url);
	}
}
